package com.controller;

import com.alibaba.fastjson.JSONObject;
import com.feign.request.RequestClient;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Fang Ruichuan
 * @date 2022-10-09 10:47
 */
@RestController
@RequiredArgsConstructor
public class FeignController {

    private final RequestClient client;

    @SneakyThrows
    @PostMapping("/getOtherServiceData")
    public JSONObject getOtherServiceData(@RequestBody JSONObject jsonObject) {
        String responseString = client.sendPost("http://localhost:9907/remindMedication/getRemindMedication", jsonObject);
        return JSONObject.parseObject(responseString);
    }
}
